#ifndef INETADDRESS_H
#define INETADDRESS_H

#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <string>

class InetAddress {
public:
    InetAddress(const uint16_t port = 0);
    InetAddress(const std::string ip = "127.0.0.1", const uint16_t port = 0);
    InetAddress(const sockaddr_in &sockaddr) : m_addr(sockaddr) {}

    std::string toIp() const;
    uint16_t toPort() const;
    std::string toIpPort() const;

    sockaddr_in* getSockAddr() {return &m_addr;}
    void setSockAddr(sockaddr_in &sockaddr) {m_addr = sockaddr;}
private:
    sockaddr_in m_addr;
};

#endif